$(function () {
    vm.title = "动态资源国际化"
});

var vm = new Vue({
    el:'#rrapp',
    data:{
        title: null,
        showList: false,
        showFieldList: false,
        dynamicCodeGenerator: {},
        i18nTypeList : [
            {"value": "1","label" : "简单属性"},
            {"value": "2","label" : "组合属性"},
            {"value": "3", "label": "自定义属性"}
            ]
    },
    methods: {
        nextStep: function (event) {
            var url = "code/generator/dynamic/init";
            $.ajax({
                type: "POST",
                url: baseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.dynamicCodeGenerator),
                success: function(r){
                    if(r.code === 0){
                        vm.showList = false;
                        vm.showFieldList = true;
                        vm.dynamicCodeGenerator = r.data;
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        saveOrUpdate: function (event) {
            var url =  "code/generator/dynamic/generator";
            $.ajax({
                type: "POST",
                url: baseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.dynamicCodeGenerator),
                success: function(r){
                    if(r.code === 0){
                        alert('操作成功', function(index){
                            // vm.reload();
                        });
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
    }
});